package com.ucomm.talent.widget;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.ucomm.talent.R;

/**
 * 自定义Toast
 * Created with IntelliJ IDEA.
 * User: Vita Hao
 * Date: 13-5-30
 * Time: 上午10:18
 * To change this template use File | Settings | File Templates.
 */
public class UToast{
    public static int UToast_SHORT = Toast.LENGTH_SHORT;
    public static int UToast_LONG = Toast.LENGTH_LONG;

    public static Toast makeText(Context context, CharSequence text, int duration) {
        Toast toast=new Toast(context);
        View view= LayoutInflater.from(context).inflate(R.layout.toast_layout, null);
        TextView tvTip=(TextView) view.findViewById(R.id.tv_toast_tip);
        tvTip.setText(text);
        toast.setDuration(duration);

        toast.setGravity(Gravity.CENTER, 0, 0);
        toast.setView(view);
        return toast;
    }
    public static Toast makeText(Context context, int res, int duration) {
        return makeText(context,context.getResources().getString(res),duration);
    }


}
